package com.sx.gongzhong.net;

import com.sx.gongzhong.model.BasePageListBean;
import com.sx.gongzhong.model.CommentBean;
import com.sx.gongzhong.model.HelpBean;
import com.sx.gongzhong.model.ReplyUserBean;

import java.util.Map;

import retrofit2.Call;

/**互帮互助
 * Created by admin on 2018/1/12.
 */

public class HelpManager {
    /**
     * 互帮互助 列表
     */
    public void getHelpListData(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<BasePageListBean<HelpBean>>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<BasePageListBean<HelpBean>>> resultCall = service.getHelpListData(map);
        resultCall.enqueue(baseCallBack);
    }
    /**
     * 互帮互助 新增
     */
    public void addHelp(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<Void>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<Void>> resultCall = service.addHelp(map);
        resultCall.enqueue(baseCallBack);
    }
    /**
     * 互帮互助  详情
     */
    public void getHelpDetail(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<HelpBean>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<HelpBean>> resultCall = service.getHelpDetail(map);
        resultCall.enqueue(baseCallBack);
    }

    /**
     * 互帮互助 大众回复列表
     */
    public void getHelpCommentList(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<BasePageListBean<CommentBean>>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<BasePageListBean<CommentBean>>> resultCall = service.getHelpCommentList(map);
        resultCall.enqueue(baseCallBack);
    }

    /**
     * 大众回复(添加)
     */
    public void addHelpComment(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<CommentBean>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<CommentBean>> resultCall = service.addHelpComment(map);
        resultCall.enqueue(baseCallBack);
    }
    /**
     * 点赞(添加)
     */
    public void addHelpPraise(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<Integer>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<Integer>> resultCall = service.addHelpPraise(map);
        resultCall.enqueue(baseCallBack);
    }
    /**
     * 关闭 不可再回复
     */
    public void closeHelp(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<Boolean>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<Boolean>> resultCall = service.closeHelp(map);
        resultCall.enqueue(baseCallBack);
    }

    /**
     * 删除
     */
    public void deleteHelp(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<Boolean>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<Boolean>> resultCall = service.deleteHelp(map);
        resultCall.enqueue(baseCallBack);
    }
    /**
     * 采纳
     */
    public void adoptComment(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<Boolean>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<Boolean>> resultCall = service.adoptComment(map);
        resultCall.enqueue(baseCallBack);
    }

    /**
     * 我的 问问 列表
     */
    public void getMyHelpListData(Map<String, Object> map, BaseCallBack<ReplyUserBean.BaseResult<BasePageListBean<HelpBean>>> baseCallBack) {
        ApiManagerService service = ServiceFactory.getInstance().createNewService(ApiManagerService.class);
        Call<ReplyUserBean.BaseResult<BasePageListBean<HelpBean>>> resultCall = service.getMyHelpListData(map);
        resultCall.enqueue(baseCallBack);
    }
}
